///////////////////////////////////////////////////////////////////////////////
//
//MM.h
// 
// Author:
//      Mark Hobbs mark@hobsie.com
// 
// Copyright (c) 2010 Mark Hobbs
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
//
///////////////////////////////////////////////////////////////////////////////

#ifndef _MARK_MATHS_H_
#define _MARK_MATHS_H_

#include <cstddef>
#include "mmDefines.h"
#include "mmVector2.h"
#include "mmVector3.h"
#include "mmMatrix.h"
#include "mmQuat.h"

namespace MM
{
	
float dotProduct(const Vector3 *vector1, const Vector3 *vector2);
float dotProduct(const Vector3 &vector1, const Vector3 &vector2);
float dotProduct(const Vector2 *vector1, const Vector2 *vector2);

void crossProduct(Vector3 &returnVector,
				  const Vector3 &vector1,
				  const Vector3 &vector2);

void quatRotation(Vector3 &returnVector,
				  const Vector3 &vector1,
				  const Vector3 &vector2,
				  float angle);
	
//////////////////////////////////////////////////////////////////////////
// Function Extern List
//////////////////////////////////////////////////////////////////////////

//! @name Quaternion Functions
//@{
//extern int m3DQuatMagnitude(LPm3DQuaternion pq, float *prf);
/*!< Calculates the magnitude of a Quaternion */
//extern int m3DQuatMagnitudeSq(LPm3DQuaternion pq, float *prf);
/*!< Calculates the square magnitude of a Quaternion */
//extern LPm3DQuaternion m3DQuatNormalise(LPm3DQuaternion pq, LPm3DQuaternion prq);
/*!< Nomalises a Quaternion */
//extern LPm3DQuaternion m3DQuatConjugate(LPm3DQuaternion pq, LPm3DQuaternion prq);
/*!< Calculates the conjugate of a Quaternion */
//@}

//! @name Matrix Functions
//@{
//extern int m3DTranspose(LPm3DMatrix pm, LPm3DMatrix prm);
/*!< Calculates the Transpose of a Matrix */
//@}

//! @name Vector Functions
//@{
//extern int m3DVecMagnitude(LPm3DVector pv, float *prf);
/*!< Calculates the magnitude of a Vector */
//extern int m3DVecMagnitudeSq(LPm3DVector pv, float *prf);
/*!< Calculates the square magnitude of a Vector */
//extern int m3DVecNormalise(LPm3DVector pv, LPm3DVector prv);
/*!< Nomalises a Vector */
//extern int m3DVecDot(LPm3DVector pV1, LPm3DVector pV2, float *prf);
/*!< Calculates the Dot/Scalar Product 2 Vectors */
//extern int m3DVecCross(LPm3DVector pV1, LPm3DVector pV2, LPm3DVector prv);
/*!< Calculates the Cross/Vector Product 2 Vectors */
//@}

//! @name Collision Functions
//@{
//extern int m3DPointOnRay(LPm3DRay pRay, float distance, LPm3DVector prv);
/*!< Calculates the vector location on a point given a distance form its
 origin */

//extern int m3DPlaneRayCol(LPm3DPlane pPlane, LPm3DRay pRay, bool *prCollision,
//float *prDistance);	/*!< Calculates if a Ray intercepts a Plane */

//extern int m3DSphereRayCol(LPm3DSphere pSphere, LPm3DRay pRay,
//bool *prCollision, float *prDistance);
/*!< Calculates if a Ray intercepts a Sphere */

//extern int m3DSpherePointCol(LPm3DSphere pSphere,LPm3DVector pv,
//bool *prCollision);	/*!< Calculates if a Point lies within a Sphere */

//extern int m3DSphereSphereCol(LPm3DSphere pS1,LPm3DSphere pS2,
//bool *prCollision);	/*!< Calculates if a Sphere intercepts a Sphere */

//extern int m3DSphereSphereDist(LPm3DSphere pS1,LPm3DSphere pS2, float *prf);
/*!< Calculates if a Sphere intercepts a Sphere and provides the distance
between the spheres */

//extern int m3DaaCuboidPointCol(LPm3DvCuboid pCuboid, LPm3DVector pv,
/*bool *prCollision);	/*!< Calculates if a Point lies within a Cuboid
(Vector Version) */

//extern int m3DaaCuboidPointCol(LPm3DqCuboid pCuboid, LPm3DVector pv,
/*bool *prCollision);	/*!< Calculates if a Point lies within a Cuboid
(Quaternion Version) */

//extern int m3DaaCuboidCuboidCol(LPm3DvCuboid pC1, LPm3DvCuboid pC2,
/*bool *prCollision);	/*!< Calculates if a Cuboid intercepts a Cuboid
(Vector Version) */

//extern int m3DaaCuboidCuboidCol(LPm3DqCuboid pC1, LPm3DqCuboid pC2,
/*bool *prCollision);	/*!< Calculates if a Cuboid intercepts a Cuboid
(Quaternion Version) */
//@}

} // namespace MM

#endif
